﻿ {extends file="profile/layout.tpl"}
 {block name="title"}##NA_WORKS##{/block}
{block name="script"}
  $(document).ready(function () {
	 $('#fromDate').datepicker({
     showOn: "focus",
       yearRange: "-80:+0",
	   changeMonth: true,
	   changeYear: true,
	   dateFormat: "mm-yy"
    });
	$('#toDate').datepicker({
     showOn: "focus",
       yearRange: "-80:+0",
	   changeMonth: true,
	   changeYear: true,
	   dateFormat: "mm-yy"
    });
	 $('table#employs td a.delete').click(function()
    {
        if (confirm("Are you sure you want to delete this row?"))
        {
            var id = $(this).parent().parent().attr('id');
            var data = 'id=' + id ;
            var url = '3.php?'+data+'&action=delete';
			window.location.href = url;
        }
    });
	
	$("#frm3").validate({
            rules: {
                employer_vi: {
                    required: true
                },
                fromDate: {
                    required: true
                },
				address: {
					required: true
				},
				position_vi: {
					required: true
				}
            },
            messages: {

                employer_vi: {
                    required: '##EM_EMPLOYER_IS_REQUIRED##'
                },
                fromDate: {
                    required: '##EM_FROMDATE_IS_REQUIRED##'
                },
				address: {
					required: '##EM_ADDRESS_IS_REQUIRED##'
				},
				position_vi: {
					required: '##EM_POSITION_IS_REQUIRED##'
				}

            }
			});
  });
{/block}
 {block name="name"}
    ##NG_WORKS##
{/block}
{block name="content"}
   

   
    <div class="clear">
        </div>	
 
    <div class="box round first center">
        <h2>##NG_WORKS##</h2>
        <table name="employs" id="employs" class="data display datatable">
            <thead>
                <tr>
                    <td bgcolor="#FFFFFF"><div align="center"><strong>
                         #
                    </strong></div></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_TIME##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_EMPLOYER##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_ADDRESS##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_POSITION##
                    </strong></td>
                    <td bgcolor="#FFFFFF" align="center"></td>
                    <td bgcolor="#FFFFFF" align="center"></td>
                </tr>
            </thead>
            
            <tbody>
            {foreach $items|default:array() as $i}
                        
                {if $i@index is div by 2}
                    <tr class="even" id="{$i.Ma}">
                {else}
                    <tr class="odd" id="{$i.Ma}">
                {/if}
                    <td><div align="center">
                            {$i@index + 1}
                    </div></td>
                    <td>
                        {$i.TuNgay|date_format:"%d-%m-%Y"} - {$i.DenNgay|date_format:"%d-%m-%Y"}
                    </td>
                    <td>
                        {$i.TenToChuc_vi}
                    </td>
                    <td>
                        {$i.DiaChi}
                    </td>
                    <td>
                        {$i.ChucVu_vi}
                    </td>
                    <td align="center"><a href="3.php?id={$i.Ma}&action=edit">  ##NG_EDIT##</a></td>
                    <td align="center"><a href="#" class="delete">##NG_DELETE##</a></td>
                </tr>            
                    
               
            {/foreach}
            </tbody> 
        </table>
    </div>
	 <div class="message error" style="display:{$is_display_error|default:'none'};">{$error_message|default:''}</div>
    <div class="box round first center">
        <h2>##NG_ADDITION_WORK_INFO##</h2>
    <form id="frm3" name="frm3" action="3.php" method="post">
 
    <table class="data display datatable" cellpadding="10" cellspacing="10" 
        align="left" border="2">
        <tbody>
            <tr>
                <input type="hidden" name="id" id="id" value="{$id|default:''}"/>
				<td style="vertical-align:middle"><strong>##NG_EMPLOYER##:</strong></td>
                <td>
                    <table>
                        <tr>
                            <td>
                                ##NG_VIETNAMESE##
                            </td>
                            <td>
                                <input id="employer_vi" type="text" value="{$employer_vi|default:''}" name="employer_vi"  maxlength="100" size="50"/>(*)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                ##NG_ENGLISH##
                            </td>
                            <td>
                                <input id="employer_en" type="text" value="{$employer_en|default:''}" maxlength="100" size="50" name="employer_en"/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>


            <tr>
                <td style="vertical-align:middle"><strong>##NG_ADDRESS##:</strong></td>
                <td>
                    <input id="address" type="text" value="{$address|default:''}" maxlength="100" size="50" name="address"/>(*)
                </td>
            </tr>

            <tr>
                <td style="vertical-align:middle"><strong>##NG_PHONE##:</strong></td>
                <td>
                   <input id="phone" type="text" value="{$phone|default:''}" maxlength="20" size="50" name="phone"/>
                </td>
            </tr>

            <tr>
                <td style="vertical-align:middle"><strong>##NG_TIME##:</strong></td>
                <td>
                    <table>
                    <tr>
                        <td>
                            ##NG_FROMDATE##:
                        </td>
                        <td>
                            <input type="text" id="fromDate" name="fromDate" value="{$fromDate|default:''|date_format:"%m-%Y"}"/>(mm-yyyy)(*)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            ##NG_TODATE##:
                        </td>
                        <td>
                            <input type="text" id="toDate" name="toDate" value="{$toDate|default:''|date_format:"%m-%Y"}"/>(mm-yyyy)
                        </td>
                    </tr>
                    </table>
                </td>
            </tr>


            <tr>
                <td style="vertical-align:middle"><strong>##NG_POSITION##:</strong></td>
                <td>
                    <table>
                        <tr>
                            <td>
                                ##NG_VIETNAMESE##:
                            </td>
                            <td>
                                <input id="position_vi" type="text" value="{$position_vi|default:''}" maxlength="45" size="50" name="position_vi"/>(*)
                            </td>
                        </tr>
                        <tr>
                            <td>
                                ##NG_ENGLISH##:
                            </td>
                            <td>
                                <input id="position_en" type="text" value="{$position_en|default:''}" maxlength="45" size="50" name="position_en"/>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>

            <tr>
                <td style="vertical-align:middle"><strong>##NG_MORE_INFO##:</strong></td>
                <td>
                    <textarea rows="4" cols="50" id="more_info" name="more_info">{$more_info|default:''}</textarea>
                </td>
            </tr>

            <tr>
                <td colspan="2">
                    <div style="float:left; height:auto">
                        <input type="submit" value="##NG_SAVE##" name="save" class="btn btn-blue"/>
                    </div>
                    <div style="float:right; height:auto">
                        <input type="button" value="##NG_NEXT##" name="next" onclick="window.location.href='4.php'" class="btn btn-blue" />
                    </div>
                </td>
            </tr>

        </tbody>
    </table>
    </form>
    </div>
    <div class="clear">
        </div>
{/block}
